﻿#region Copyright Info

// 
// Majesty of Omega - The next evolution of macro management space strategy
// 
// Copyright 2007-2009 André Claaßen
// 
// This file is protected by the terms and conditions of the
// Microsoft Community License (Ms-CL 1.1), a copy of which should
// have been distributed along with this software. If not,
// you may find the license information at the following URL:
// 
// http://www.microsoft.com/resources/sharedsource/licensingbasics/communitylicense.mspx

#endregion

#region

#if NUNIT
using System.ComponentModel;
using NUnit.Framework;
using TestClass = NUnit.Framework.TestFixtureAttribute;
using TestMethod = NUnit.Framework.TestAttribute;
using TestInitialize = NUnit.Framework.SetUpAttribute;
using TestCleanup = NUnit.Framework.TearDownAttribute;
using ClassInitialize = NUnit.Framework.TestFixtureSetUpAttribute;
using ClassCleanup = NUnit.Framework.TestFixtureTearDownAttribute;
#elif MBUNIT
using MbUnit.Framework;
using TestClass = MbUnit.Framework.TestFixtureAttribute;
using TestMethod = MbUnit.Framework.TestAttribute;
using TestInitialize = MbUnit.Framework.SetUpAttribute;
using TestCleanup = MbUnit.Framework.TearDownAttribute;
using ClassInitialize = MbUnit.Framework.TestFixtureSetUpAttribute;
using ClassCleanup = MbUnit.Framework.TestFixtureTearDownAttribute;
#else
using Microsoft.VisualStudio.TestTools.UnitTesting;
#endif

using Majesty_of_Omega.GUI.Pages.Game.Research.Parts;

#endregion

namespace Test.Majesty_of_Omega.GUI.Pages.Game.Research
{
    /// <summary>
    /// Summary description for TestPercentageBar
    /// </summary>
    [TestClass]
    public class TestResearchPointPart
    {
        /// <summary>
        /// Tests the research point user control.
        /// </summary>
        [TestMethod]
        public void TestResearchPointUserControl()
        {
            ResearchPointPart part = new ResearchPointPart {AppliedResearch = 50, FundamentalResearch = 150};

            // check percentage calculation
            Assert.AreEqual(25, part.AppliedResearchPercentage);
            Assert.AreEqual(75, part.FundamentalResearchPercentage);

            string propertyChanged = "";
            part.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
            {
                propertyChanged = e.PropertyName;
            };

            part.AppliedResearch = 200;
            Assert.AreEqual("AppliedResearchPercentage", propertyChanged, 
                            "Changes on the applied research property must result in a notification, " +
                            "that the corresponding percentage value has also be changed");
        }
    }
}